package com.school.dcc.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

@Configuration
@EnableSwagger2
public class SwaggerConfig {


    //配置了Swagger的Docket的Bean实例
     @Bean
     public Docket docket(){
         return new Docket(DocumentationType.SWAGGER_2)
                 .apiInfo(apiInfo())
                 .groupName("又菜又爱玩")
                 .select()
                 //RequestHandlerSelectors配置要扫描的接口的方式
                 //basePackage指定扫描的包
                 .apis(RequestHandlerSelectors.basePackage("com.school.dcc"))
                 //过滤路径
                 //.paths(PathSelectors.any(""))
                 .build();  //build
     }

     //配置Swagger 信息 = apiInfo
     private ApiInfo apiInfo(){

         //作者信息
         Contact Contact = new Contact("又菜又爱玩", "https://blog.csdn.net/biancheng4?spm=1000.2115.3001.5343", "1605724068@qq.com");
         return  new ApiInfo("个人学习",
                 "信息工程学院105工作室",
                 "1.0", "https://blog.csdn.net/biancheng4?spm=1000.2115.3001.5343",
                 Contact, "Apache 2.0",
                 "http://www.apache.org/licenses/LICENSE-2.0",
                 new ArrayList());
     }




}

